A semiconductor device such as a flash memory is used for various electronic devices.